//************************************************************************
/// <copyrigth>2024-2025 Corporation.All Rights Reserved</copyrigth>
/// <author>tangyingzhong</author>
/// <contact>tangyz114987@outlook.com</contact>
/// <version>v1.0.0</version>
/// <describe>
/// Cross-Platform ini file(Key format: SectionKey.ValueKey)
///</describe>
/// <date>2024/1/8</date>
///***********************************************************************
#ifndef INI_H
#define INI_H

#include <string>
#include "ModuleLoader/ModuleConfig.h"

namespace SystemTool
{
    class CLASS_ITEM Ini
    {
    public:
        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, std::string &strDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, int &iDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, unsigned int &iDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, short &iDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, unsigned short &iDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, long long &lDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, unsigned long long &ulDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, double &dDefaultValue);

        // Get data by key
        static bool GetKey(std::string strFilePath, std::string strAppKey, std::string strKey, bool &bDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, std::string strDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, int iDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, unsigned int iDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, short iDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, unsigned short iDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, long long lDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, unsigned long long ulDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, double dDefaultValue);

        // Set data with key value
        static bool SetKey(std::string strFilePath, std::string strAppKey, std::string strKey, bool bDefaultValue);

    private:
        // Get string by key(Key format: SectionKey.ValueKey)
        static bool GetString(std::string strIniFilePath, std::string strKey, std::string &strValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetInt(std::string strIniFilePath, std::string strKey, int &iValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetUInt(std::string strIniFilePath, std::string strKey, unsigned int &iValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetInt16(std::string strIniFilePath, std::string strKey, short &iValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetUInt16(std::string strIniFilePath, std::string strKey,unsigned short& iValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetInt64(std::string strIniFilePath, std::string strKey, long long &iValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetUInt64(std::string strIniFilePath, std::string strKey, unsigned long long &iValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetDouble(std::string strIniFilePath, std::string strKey,double& dValue);

        // Get data by key(Key format: SectionKey.ValueKey)
        static bool GetBool(std::string strIniFilePath, std::string strKey, bool &bValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetString(std::string strIniFilePath, std::string strKey, std::string strValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetInt(std::string strIniFilePath, std::string strKey, int iValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetUInt(std::string strIniFilePath, std::string strKey, unsigned int uValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetInt16(std::string strIniFilePath, std::string strKey, short sValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetUInt16(std::string strIniFilePath, std::string strKey, unsigned short uValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetInt64(std::string strIniFilePath, std::string strKey, long long lValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetUInt64(std::string strIniFilePath, std::string strKey, unsigned long long ulValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetDouble(std::string strIniFilePath, std::string strKey, double dValue);

        // Set data by key(Key format: SectionKey.ValueKey)
        static void SetBool(std::string strIniFilePath, std::string strKey, bool bValue);
    };
}

#endif // INI_H
